package com.wangsai.framework.supersecurity.example.cloud.client.controller;

import com.wangsai.framework.supersecurity.example.cloud.commons.MyIUser;
import com.wangsai.framework.supersecurity.example.cloud.dubboapi.UserClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Mr.Wang
 * @description
 * @date 2021-08-25 09:32
 */
@Api(tags = "dubbo测试模块")
@RestController
@RequestMapping("/dubbo")
public class DubboController {

    @DubboReference
    UserClient userClient;

    @ApiOperation(value = "获取访问IP")
    @GetMapping("/getIp")
    public String getIp() {
        return userClient.getUser().getIp();
    }


    @ApiOperation(value = "获取用户")
    @GetMapping("/getUser")
    public MyIUser getUser() {
        return userClient.getUser();
    }

}